package com.cswangdao.mapper;

import com.cswangdao.domain.model.MarketCart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface MarketCartMapper {

    List<Integer> getGoodsCountByUserId(@Param("userId") Integer userId);

    void addCartInfo(MarketCart cart);

    MarketCart isExist(@Param("userId") Integer userId, @Param("goodsId") Integer goodsId, @Param("productId") Integer productId);

    void updateCartInfo(MarketCart hasCart);

    List<MarketCart> getCartListByUserId(@Param("userId") int userId);

    void updateCartCheckedStatus(Map map);

    MarketCart getById(@Param("cartId") Integer cartId);

    void deleteBatch(List<Integer> cartIds);

    void deleteByUserIdAndProductIds(@Param("userId") int userId, @Param("productIds") List<Integer> productIds);

    @Update(("update  market_cart set number = #{number} where id = #{cartId}"))
    void updateProductNumber(@Param("cartId") int cartId, @Param("number") int number);
}